<!-- 估值水平 -->
<template>
  <div class="table w1021">
    <div class="tableTh tableTr flex">
      <span class="tableTd w130">排名</span>
      <span class="tableTd w130">公司代码</span>
      <span class="tableTd w130">中文简称</span>
      <span class="tableTd w220 cursor" @click="columnClick(1)">
        PEG
        <span v-show="column==1">↓</span>
      </span>
      <span class="tableTd w220 cursor" @click="columnClick(2)">
        市盈率TTM（倍）
        <span v-show="column==2">↓</span>
      </span>
      <span class="tableTd w220 cursor" @click="columnClick(3)">
        市现率TTM（倍）
        <span v-show="column==3">↓</span>
      </span>
      <span class="tableTd w220 cursor" @click="columnClick(4)">
        市净率（倍）
        <span v-show="column==4">↓</span>
      </span>
      <span class="tableTd w220 cursor" @click="columnClick(5)">
        市销率（倍）
        <span v-show="column==5">↓</span>
      </span>
    </div>
    <div class="tableTr tableBody top flex" v-for="(item,index) in data" :key="index">
      <span class="orange tableTd w130">{{item.rank|filterVal}}</span>
      <span class="orange tableTd w130">{{item.stockCode|filterVal}}</span>
      <span class="orange tableTd w130">{{item.stockName|filterVal}}</span>
      <span class="orange tableTd w220">{{item.peg|filterVal("numberNo")}}</span>
      <span class="orange tableTd w220">{{item.pe|filterVal("numberNo")}}</span>
      <span class="orange tableTd w220">{{item.pc|filterVal("numberNo")}}</span>
      <span class="orange tableTd w220">{{item.pb|filterVal("numberNo")}}</span>
      <span class="orange tableTd w220">{{item.ps|filterVal("numberNo")}}</span>
    </div>
    <div class="tableNone orange w1021 top" v-if="data.length==0">暂无数据</div>
  </div>
</template>

<script>
import { numberNo } from "../../script/api";
export default {
  data() {
    return {
      column: 1
    };
  },
  props: ["data"],
  filters: {
    filterVal(ops, num) {
      if (ops && num == "numberNo") {
        return numberNo(ops, num);
      }
      return ops ? ops : "--";
    }
  },
  components: {},
  computed: {},
  mounted() {},
  methods: {
    columnClick(ops) {
      if (this.column == ops) return;
      this.column = ops;
      this.$emit("update", { column: ops, method: "valuation" });
    }
  }
};
</script>
<style lang='scss' scoped>
</style>